<?php
session_start();
?>
<?php
//if (!is_mobile()) {
//echo "我觉得用微信看好点、所以就把pc看的禁了，sorry";
//die();
//} 
if (!isset($_SESSION['is_show'])) {
	$_SESSION['is_show'] = 1;
	header("location: http://viewer.maka.im/k/CF7K29VU");
} else {
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title> 玥，开发中</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="./button.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="/">My玥</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="/">首页<span class="sr-only">(current)</span></a></li>
        <li><a href="#">旅行图片</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">小日记<span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="day.php">旅行笔记</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="./talk.php">耳语</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">大声说出来</a></li>
          </ul>
        </li>
      </ul>
      <form class="navbar-form navbar-left" role="search" action = "./talk.php">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="搜我对你说的话">
        </div>
        <button type="submit" class="btn btn-default">搜索</button>
      </form>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="http://viewer.maka.im/k/CF7K29VU">我们的故事</a></li>
        </li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>
<div class = "container" style = "padding-top:120px;">
<div class = "row">
<div class = "col-xs-6">
<div style = "float:right">
<span class="button-wrap">
<a href="http://viewer.maka.im/k/CF7K29VU" class="button button-glow button-circle button-action button-jumbo">故事</a>
</span>
</div>
</div>
<div class = "col-xs-6">
<span class="button-wrap">
<a href="./photo.php" class="button button-glow button-circle button-action button-jumbo">相册</a>
</span>
</div>
</div>
<div class = "row" style = "padding-top:20px">
<div class = "col-xs-6">
<div style = "float:right">
<span class="button-wrap">
<a href="./day.php" class="button button-glow button-circle button-action button-jumbo">日记</a>
</span>
</div>
</div>
<div class = "col-xs-6">
<span class="button-wrap">
<a href="./talk.php" class="button button-glow button-circle button-action button-jumbo">耳语</a>
</span>
</div>
</div>
</div>
<?php
}
/**
 * 是否移动端访问访问
 *
 * @return bool
 */
function is_mobile()
{ 
  // 如果有HTTP_X_WAP_PROFILE则一定是移动设备
  if (isset ($_SERVER['HTTP_X_WAP_PROFILE']))
  {
    return true;
  } 
  // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息
  if (isset ($_SERVER['HTTP_VIA']))
  { 
    // 找不到为flase,否则为true
    return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
  } 
  // 脑残法，判断手机发送的客户端标志,兼容性有待提高
  if (isset ($_SERVER['HTTP_USER_AGENT']))
  {
    $clientkeywords = array ('nokia',
      'sony',
      'ericsson',
      'mot',
      'samsung',
      'htc',
      'sgh',
      'lg',
      'sharp',
      'sie-',
      'philips',
      'panasonic',
      'alcatel',
      'lenovo',
      'iphone',
      'ipod',
      'blackberry',
      'meizu',
      'android',
      'netfront',
      'symbian',
      'ucweb',
      'windowsce',
      'palm',
      'operamini',
      'operamobi',
      'openwave',
      'nexusone',
      'cldc',
      'midp',
      'wap',
      'mobile'
      ); 
    // 从HTTP_USER_AGENT中查找手机浏览器的关键字
    if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT'])))
    {
      return true;
    } 
  } 
  // 协议法，因为有可能不准确，放到最后判断
  if (isset ($_SERVER['HTTP_ACCEPT']))
  { 
    // 如果只支持wml并且不支持html那一定是移动设备
    // 如果支持wml和html但是wml在html之前则是移动设备
    if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html'))))
    {
      return true;
    } 
  } 
  return false;
}
?>
</body>
</html>
